/* 
 * Cashbox is the legal property of its developers, whose names are listed in the copyright file included
 * with this source distribution.
 * 
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program; if not,
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#import <Cashbox/CBListObject.h>
#import <Cashbox/CBTransaction.h>

@protocol CBAccount
+ (Class)transactionClass;
+ (NSString *)sortKey;
+ (NSString *)name;
@end

/* CBAccount is an abstract class.  Concrete classes should be
 * implemented by subclassing CBAccount and implementing the
 * CBAccount protocol. */
@interface CBAccount : CBListObject {
}

// runs a fetch request to get the accounts that have
// an attribute set equal to any one of the sets passed in the array
+ (NSArray *)accountsWithAnyAccountType:(NSArray *)array;
// runs a fetch request to get the first account that has
// a name equal to the given name
+ (CBAccount *)accountWithName:(NSString *)name;
// creates an array of types provided by the transaction class
+ (NSArray *)roles;

@property (retain) NSString *additionalInfo;
@property (retain) NSString *name;
@property (retain) NSNumber *number;
@property (retain, readonly) NSSet *transactions;

- (long long)total;

@end

@interface CBAccount (CoreDataGeneratedAccessors)
- (void)addTransactionsObject:(CBTransaction *)value;
- (void)removeTransactionsObject:(CBTransaction *)value;
- (void)addTransactions:(NSSet *)value;
- (void)removeTransactions:(NSSet *)value;
@end
